package com.restaurant.application.scoreset.support;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;

import java.util.List;

public class ScoreSetPageData implements PickableBean {

    public static final String FN_SHOPID = "shopId";
    public static final String FN_SHOPNAME = "shopName";
    public static final String FN_PAYING = "paying";
    public static final String FN_SCORE = "score";
    public static final String FN_SEQ = "seq";

    public static final List<String> FIELD_NAMES = Lists.newArrayList(
            FN_SHOPID,
            FN_SHOPNAME,
            FN_PAYING,
            FN_SCORE,
            FN_SEQ);
    
    private String shopId;
    private String shopName;
    private Long paying;
    private Integer score;
    private Long seq;

    public ScoreSetPageData(String shopId, String shopName, Long paying, Integer score, Long seq) {
        setShopId(shopId);
        setShopName(shopName);
        setPaying(paying);
        setScore(score);
        setSeq(seq);
    }

    public ScoreSetPageData() {
    }

    public ScoreSetPageData duplicate() {
        ScoreSetPageData result = new ScoreSetPageData();
        result.shopId = this.shopId;
        result.shopName = this.shopName;
        result.paying = this.paying;
        result.score = this.score;
        result.seq = this.seq;
        return result;
    }

    @Override
    public String toString() {
        return Convert.toJson(this);
    }

    public String getShopId() {
        return shopId;
    }

    public void setShopId(String value) {
        this.shopId = value;
    }

    public ScoreSetPageData withShopId(String value) {
        setShopId(value);
        return this;
    }

    public ScoreSetPageData withShopId(String value, String defaultValue) {
        setShopId(value == null ? defaultValue : value);
        return this;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String value) {
        this.shopName = value;
    }

    public ScoreSetPageData withShopName(String value) {
        setShopName(value);
        return this;
    }

    public ScoreSetPageData withShopName(String value, String defaultValue) {
        setShopName(value == null ? defaultValue : value);
        return this;
    }

    public Long getPaying() {
        return paying;
    }

    public void setPaying(Long value) {
        this.paying = value;
    }

    public ScoreSetPageData withPaying(Long value) {
        setPaying(value);
        return this;
    }

    public ScoreSetPageData withPaying(Long value, Long defaultValue) {
        setPaying(value == null ? defaultValue : value);
        return this;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer value) {
        this.score = value;
    }

    public ScoreSetPageData withScore(Integer value) {
        setScore(value);
        return this;
    }

    public ScoreSetPageData withScore(Integer value, Integer defaultValue) {
        setScore(value == null ? defaultValue : value);
        return this;
    }

    public Long getSeq() {
        return seq;
    }

    public void setSeq(Long value) {
        this.seq = value;
    }

    public ScoreSetPageData withSeq(Long value) {
        setSeq(value);
        return this;
    }

    public ScoreSetPageData withSeq(Long value, Long defaultValue) {
        setSeq(value == null ? defaultValue : value);
        return this;
    }

    public Object getValueOf(String name) {
        switch (name) {
            case "shopId":
                return getShopId();
            case "shopName":
                return getShopName();
            case "paying":
                return getPaying();
            case "score":
                return getScore();
            case "seq":
                return getSeq();
        }
        return null;
    }

    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }

    @Override
    public int hashCode() {
        return signature().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof ScoreSetPageData)) return false;
        return signature().equals(((ScoreSetPageData) o).signature());
    }

    public String signature() {
        throw new RuntimeException("Bean ScoreSetPageData has no signature defined, no hash code or equals possible.");
    }
}
